#include <stdio.h>
#include <string.h>

static int aaa[6] = {3,5,1,2,8,0};

void quick_sort(int* a, int begin, int end)
{
    if (begin >= end)
        return;
    int privot = a[end];
    int i = begin, j = begin;
    while (i < end) {
        if (a[i] < privot) {
            int tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
            j++;
        }
        i++;
    }
    int tmp = a[end];
    a[end] = a[j];
    a[j] = tmp;

    quick_sort(a, begin, j - 1);
    quick_sort(a, j, end);

}

int main()
{

    quick_sort(aaa, 0, 5);

    for (int i = 0; i< 6; i++) {
        printf("%d ", aaa[i]);
    }
    printf("\n");
    return 0;
}